//-----------------------------------------------------------------------
// <copyright file="GiaoDichServiceBase.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using Pyco;
using Pyco.Diagnostics;
using Pyco.Data;
using APPro.Entities;
using APPro.Data;
    
namespace APPro.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class GiaoDichServiceBase
    {
        #region GiaoDichServiceBase

        public static void CreateGiaoDich(GiaoDich giaoDich)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                giaoDichDAO.CreateGiaoDich(giaoDich);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessCreateGiaoDichException, ex);
            }
        }

        public static void UpdateGiaoDich(GiaoDich giaoDich)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                giaoDichDAO.UpdateGiaoDich(giaoDich);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessUpdateGiaoDichException, ex);
            }
        }        

        public static void DeleteGiaoDich(string mobile, DateTime ngayGD, DateTime gioGD)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                giaoDichDAO.DeleteGiaoDich(mobile, ngayGD, gioGD);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessDeleteGiaoDichException, ex);
            }
        }
		
        public static GiaoDich GetGiaoDich(string mobile, DateTime ngayGD, DateTime gioGD)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                return giaoDichDAO.GetGiaoDich(mobile, ngayGD, gioGD);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiaoDichException, ex);
            }
        }                
		
        public static GiaoDichCollection GetGiaoDichList(GiaoDichColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                return giaoDichDAO.GetGiaoDichList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiaoDichListException, ex);
            }
        }        

        public static GiaoDichCollection GetGiaoDichList(GiaoDichColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                GiaoDichDAO giaoDichDAO = new GiaoDichDAO();
                return giaoDichDAO.GetGiaoDichList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SRBase.BusinessGetGiaoDichListException, ex);
            }
        }        
		
		
        #endregion
    }
}